<script lang="ts" setup>
import { defineEmits, defineProps, ref } from 'vue';

withDefaults(
  defineProps<{
    open?: Boolean;
    roleId: string;
  }>(),
  {
    open: false, // 默认值
  },
);
const emit = defineEmits(['close']);

const dataSource = ref([]);
const checkedKeys = ref<string[]>([]);

const onClose = () => {
  emit('close');
};
</script>
<template>
  <a-modal :visible="open" title="授权菜单" @ok="onClose" @cancel="onClose">
    <a-tree
      checkable
      :tree-data="dataSource"
      :field-names="{ key: 'id' }"
      v-model:checked-keys="checkedKeys"
      :auto-expand-parent="true"
    />
  </a-modal>
</template>
